package com.c.ctgproject.ui.files.callback

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.c.ctgproject.base.BaseView
import com.c.ctgproject.base.BaseViewModel
import com.c.ctgproject.http.ApiMethods
import com.c.ctgproject.utils.awaitSync
import com.c.ctgproject.utils.launch
import okhttp3.RequestBody

class FileManagerDetailViewModel:BaseViewModel(){
    private val mResult = MutableLiveData<String>()
    val result: LiveData<String> get() = mResult

    fun detail(carId:String){
        launch {
            mResult.value=ApiMethods.retrofit.fileManagerDetail(carId).awaitSync()
        }
    }
    private val mSubmitResult = MutableLiveData<String>()
    val submitResult: LiveData<String> get() = mSubmitResult
    fun submit(body: RequestBody){
        launch {
            mSubmitResult.value=ApiMethods.retrofit.fileManagerDetailConfirm(body).awaitSync()
        }
    }

    private val mRemarkResult = MutableLiveData<String>()
    val remarkResult: LiveData<String> get() = mRemarkResult
    fun submitRemark(carId: String,remark:String){
        launch {
            mRemarkResult.value=ApiMethods.retrofit.fileManagerDetailConfirmRemark(carId,remark).awaitSync()
        }
    }

}